#include "Bitmap.h"


void Bitmap::Load (HINSTANCE hInst, char const * resName)
{
    Free ();
    _hBitmap = (HBITMAP) ::LoadImage (hInst, 
        resName,
        IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);
}
void Bitmap::Load (HINSTANCE hInst, int id)
{
    Free ();
    _hBitmap = (HBITMAP) ::LoadImage (hInst, 
        MAKEINTRESOURCE (id),
        IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION);

}
void Bitmap::Load (char * path)
{
    Free ();
    _hBitmap = (HBITMAP) ::LoadImage (0, path, 
        IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);

}
void Bitmap::GetSize (int & width, int & height)
{
    BITMAP bm;
    ::GetObject (_hBitmap, sizeof (bm), & bm);
    width = bm.bmWidth;
    height = bm.bmHeight;
}